Package com.streamwide.smartms.lib.core.api.account

Types

Link copied to clipboard
annotation class ConnectionState
Link copied to clipboard
open class OauthTokenError : Error
Link copied to clipboard
interface ResetAppDataCallBack
This callback is used in reset application data process task
Link copied to clipboard
open class STWAccountError : Error
Link copied to clipboard
open class STWAccountManager
STWAccountManagerThis class represent the API for all actions/event related to the user accountThis class offers several possible operations defined in the following list:
  • Login
  • Logout
  • Manage all account settings
  • Listen to all changes of account settings
 Login
  • 
    STWAccountManager.getInstance().login(BaseLoginActivity.this, number, companyId, new STWAccountManager.CompletionCallback() {
    
         public void onSecondStepStarted(int loginStatus) {
               //Code...
         }
    
         public void onCompletion(int loginType, Bundle data) {
               //Code...
         }
    
         public void onError(int loginFailReason, Bundle data) {
               //Code...
         }
         });
    
  • 
    STWAccountManager.getInstance().confirmLogin(context, activationCode, new STWAccountManager.CompletionCallback() {
    
         public void onSecondStepStarted(int loginStatus) {
                //Your code here
         }
    
         public void onCompletion(int loginType, Bundle data) {
                //Your code here
         }
    
         public void onError(int loginFailReason, Bundle data) {
                //Your code here
         }
    });
    
 Logout

STWAccountManager.getInstance().launchLogoutProcess(context,true, new LogoutCallBack() {

     public void onStart() {
            //Code ...
     }

     public void onFinish() {
            //Code ...
     }

     public void onError() {
            //Code ...
     }
});

Manage all account settings

//Delete user picture
 STWAccountManager.getInstance().deleteUserPicture(new STWSettingRequestCallback() {

     public void onSuccess(){
           //Code ...
     }

     public void onFail() {
           //Code ...
     }

     public void onError(){
          //Code ...
     }
});
Get company id

         String companyId = STWAccountManager.getInstance().getCompanyId(context);
     
Listen to all changes of account settings

STWAccountManager.getInstance().registerAccountSettingsListener(new STWAccountSettingsListener() {

     public void onAccountSettingsUpdated(){
           //Code..
     }
});

Link copied to clipboard
interface STWAccountSessionCallback : STWCallback<T>
A callback to account session states and errors
Link copied to clipboard
interface STWAppVersionListener
Listener used to handle events related App version changes
Link copied to clipboard
interface STWAutomaticDisconnectListener
Link copied to clipboard
interface STWDisconnectCallBack : STWCallback<T>

Description :

This callback is used in STWAccountManager when doing the local user disconnect

Example of use :

  • Implementation :
    
    LogoutCallBack mLogoutCallBack = new LogoutCallBack() {
    public void onStart() {
    
    }
    
    public void onFinish() {
    
    }
    
    public void onError(STWAccountError error) {
    
    }
    }
    
  • Register :
    
            STWAccountManager.getInstance().logout(context,informAdmin, mLogoutCallBack);
            
Link copied to clipboard
interface STWOauthTokenCallback<T : Error?> : STWCallback<T>
This is a callback to handle events related to Oauth token request.